package com.gz.steak.common.exception;

/**
 * @Author 刘牌
 * @Date 2020/2/22 0022 13:09
 * @Version 1.0
 */

public class BusinessException extends RuntimeException implements CommonError {
    private CommonError commonError;

    public BusinessException(CommonError commonError){
        this.commonError = commonError;
    }

    public BusinessException(CommonError commonError , String errorMsg){
        this.commonError = commonError;
        this.commonError.setErrorMsg(errorMsg);
    }

    @Override
    public int getErrorCode() {
        return this.commonError.getErrorCode();
    }

    @Override
    public String getErrorMsg() {
        return this.commonError.getErrorMsg();
    }

    @Override
    public CommonError setErrorMsg(String errorMsg) {
        this.commonError.setErrorMsg(errorMsg);
        return this;
    }

}
